package org.boyan.modules.cgform.c;

import cn.hutool.core.io.FileUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.google.common.collect.Lists;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.sql.DataSource;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.shiro.SecurityUtils;
import org.boyan.common.api.vo.Result;
import org.boyan.common.aspect.annotation.AutoLog;
import org.boyan.common.aspect.annotation.OnlineAuth;
import org.boyan.common.aspect.annotation.PermissionData;
import org.boyan.common.constant.enums.ModuleType;
import org.boyan.common.exception.JeecgBootException;
import org.boyan.common.system.api.ISysBaseAPI;
import org.boyan.common.system.vo.DictModel;
import org.boyan.common.system.vo.LoginUser;
import org.boyan.common.util.BrowserUtils;
import org.boyan.common.util.SpringContextUtils;
import org.boyan.common.util.TokenUtils;
import org.boyan.common.util.oConvertUtils;
import org.boyan.modules.auth.service.IOnlAuthPageService;
import org.boyan.modules.cgform.converter.b;
import org.boyan.modules.cgform.entity.OnlCgformField;
import org.boyan.modules.cgform.entity.OnlCgformHead;
import org.boyan.modules.cgform.model.OnlComplexModel;
import org.boyan.modules.cgform.model.OnlGenerateModel;
import org.boyan.modules.cgform.model.TreeModel;
import org.boyan.modules.cgform.service.IOnlCgformFieldService;
import org.boyan.modules.cgform.service.IOnlCgformHeadService;
import org.boyan.modules.cgform.service.IOnlCgformSqlService;
import org.boyan.modules.cgform.service.IOnlineJoinQueryService;
import org.boyan.modules.cgform.service.IOnlineService;
import org.boyan.modules.cgform.util.d;
import org.boyan.modules.config.exception.BusinessException;
import org.boyan.modules.config.exception.DBException;
import org.jeecgframework.poi.excel.ExcelExportUtil;
import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.entity.params.ExcelExportEntity;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.jdbc.support.incrementer.OracleSequenceMaxValueIncrementer;
import org.springframework.jdbc.support.incrementer.PostgreSQLSequenceMaxValueIncrementer;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;

@RestController("onlCgformApiController")
@RequestMapping({"/online/cgform/api"})
public class a {
    private static final Logger a = LoggerFactory.getLogger(a.class);

    @Autowired
    private IOnlCgformHeadService onlCgformHeadService;

    @Autowired
    IOnlineJoinQueryService onlineJoinQueryService;

    @Autowired
    private IOnlCgformFieldService onlCgformFieldService;

    @Autowired
    private IOnlCgformSqlService onlCgformSqlService;

    @Autowired
    private IOnlAuthPageService onlAuthPageService;

    @Autowired
    private ISysBaseAPI sysBaseAPI;

    @Autowired
    private IOnlineService onlineService;

    @Value("${boyan.path.upload}")
    private String upLoadPath;

    @Value("${boyan.uploadType}")
    private String uploadType;

    @PostMapping({"/addAll"})
    public Result<?> a(@RequestBody org.boyan.modules.cgform.model.a parama) {
        try {
            String str = parama.getHead().getTableName();
            if (org.boyan.modules.config.b.d.a(str)) {
                return Result.error("数据库表[" + str + "]已存在,请从数据库导入表单");
            }
            return this.onlCgformHeadService.addAll(parama);
        } catch (Exception exception) {
            a.error("OnlCgformApiController.addAll()发生异常：" + exception.getMessage(), exception);
            return Result.error("操作失败");
        }
    }

    @PutMapping({"/editAll"})
    @CacheEvict(value = {"sys:cache:online:list", "sys:cache:online:form"}, allEntries = true, beforeInvocation = true)
    public Result<?> b(@RequestBody org.boyan.modules.cgform.model.a parama) {
        try {
            return this.onlCgformHeadService.editAll(parama);
        } catch (Exception exception) {
            a.error("OnlCgformApiController.editAll()发生异常：" + exception.getMessage(), exception);
            return Result.error("操作失败");
        }
    }

    @AutoLog(operateType = 1, value = "online列表加载", module = ModuleType.ONLINE)
    @OnlineAuth("getColumns")
    @GetMapping({"/getColumns/{code}"})
    public Result<OnlComplexModel> a(@PathVariable("code") String paramString) {
        Result<OnlComplexModel> result = new Result();
        OnlCgformHead onlCgformHead = (OnlCgformHead)this.onlCgformHeadService.getById(paramString);
        if (onlCgformHead == null) {
            result.error500("实体不存在");
            return result;
        }
        LoginUser loginUser = (LoginUser)SecurityUtils.getSubject().getPrincipal();
        OnlComplexModel onlComplexModel = this.onlineService.queryOnlineConfig(onlCgformHead, loginUser.getUsername());
        onlComplexModel.setIsDesForm(onlCgformHead.getIsDesForm());
        onlComplexModel.setDesFormCode(onlCgformHead.getDesFormCode());
        result.setResult(onlComplexModel);
        result.setOnlTable(onlCgformHead.getTableName());
        return result;
    }

    @AutoLog(operateType = 1, value = "online列表数据查询", module = ModuleType.ONLINE)
    @PermissionData
    @OnlineAuth("getData")
    @GetMapping({"/getData/{code}"})
    public Result<Map<String, Object>> a(@PathVariable("code") String paramString, HttpServletRequest paramHttpServletRequest) {
        Result<Map<String, Object>> result = new Result<>();
        OnlCgformHead onlCgformHead = (OnlCgformHead)this.onlCgformHeadService.getById(paramString);
        if (onlCgformHead == null) {
            result.error500("实体不存在");
            return result;
        }
        Map<String, Object> map = null;
        try {
            Map<String, Object> map1 = org.boyan.modules.cgform.util.b.a(paramHttpServletRequest);
            boolean bool = org.boyan.modules.cgform.util.b.a(onlCgformHead);
            if (bool) {
                map = this.onlineJoinQueryService.pageList(onlCgformHead, map1);
            } else {
                map = this.onlCgformFieldService.queryAutolistPage(onlCgformHead.getTableName(), paramString, map1, null);
            }
            a(onlCgformHead, map);
            result.setResult(map);
        } catch (Exception exception) {
            a.error(exception.getMessage(), exception);
            result.error500("数据库查询失败，" + exception.getMessage());
        }
        result.setOnlTable(onlCgformHead.getTableName());
        return result;
    }

    @AutoLog(operateType = 1, value = "online表单加载", module = ModuleType.ONLINE)
    @OnlineAuth("getFormItem")
    @GetMapping({"/getFormItem/{code}"})
    public Result<?> b(@PathVariable("code") String paramString, HttpServletRequest paramHttpServletRequest) {
        OnlCgformHead onlCgformHead = (OnlCgformHead)this.onlCgformHeadService.getById(paramString);
        if (onlCgformHead == null) {
            Result.error("表不存在");
        }
        Result<JSONObject> result = new Result<>();
        LoginUser loginUser = (LoginUser)SecurityUtils.getSubject().getPrincipal();
        JSONObject jSONObject = this.onlineService.queryOnlineFormItem(onlCgformHead, loginUser.getUsername());
        result.setResult(org.boyan.modules.cgform.util.b.b(jSONObject));
        assert onlCgformHead != null;
        result.setOnlTable(onlCgformHead.getTableName());
        return result;
    }

    @AutoLog(operateType = 1, value = "online根据表名加载表单", module = ModuleType.ONLINE)
    @GetMapping({"/getFormItemBytbname/{table}"})
    public Result<?> a(@PathVariable("table") String paramString1, @RequestParam(name = "taskId", required = false) String paramString2) {
        Result<JSONObject> result = new Result<>();
        LambdaQueryWrapper<OnlCgformHead> lambdaQueryWrapper = new LambdaQueryWrapper<>();
        lambdaQueryWrapper.eq(OnlCgformHead::getTableName, paramString1);
        OnlCgformHead onlCgformHead = this.onlCgformHeadService.getOne(lambdaQueryWrapper);
        if (onlCgformHead == null) {
            Result.error("表不存在");
        }
        LoginUser loginUser = (LoginUser)SecurityUtils.getSubject().getPrincipal();
        JSONObject jSONObject = this.onlineService.queryFlowOnlineFormItem(onlCgformHead, loginUser.getUsername(), paramString2);
        result.setResult(org.boyan.modules.cgform.util.b.b(jSONObject));
        result.setOnlTable(paramString1);
        return result;
    }

    @OnlineAuth("getEnhanceJs")
    @GetMapping({"/getEnhanceJs/{code}"})
    public Result<?> c(@PathVariable("code") String paramString, HttpServletRequest paramHttpServletRequest) {
        String str = this.onlineService.queryEnahcneJsString(paramString, "form");
        return Result.ok(str);
    }

    @AutoLog(operateType = 1, value = "online表单数据查询")
    @GetMapping({"/form/{code}/{id}"})
    public Result<?> b(@PathVariable("code") String paramString1, @PathVariable("id") String paramString2) {
        try {
            Map<String, Object> map = this.onlCgformHeadService.queryManyFormData(paramString1, paramString2);
            return Result.ok(org.boyan.modules.cgform.util.b.b(map));
        } catch (Exception exception) {
            a.error("Online表单查询异常：" + exception.getMessage(), exception);
            return Result.error("查询失败，" + exception.getMessage());
        }
    }

    @GetMapping({"/subform/{table}/{mainId}"})
    public Result<?> c(@PathVariable("table") String paramString1, @PathVariable("mainId") String paramString2) {
        try {
            Map<String, Object> map = this.onlCgformHeadService.querySubFormData(paramString1, paramString2);
            return Result.ok(org.boyan.modules.cgform.util.b.b(map));
        } catch (Exception exception) {
            a.error("Online表单查询异常：" + exception.getMessage(), exception);
            return Result.error("查询失败，" + exception.getMessage());
        }
    }

    @GetMapping({"/subform/list/{table}/{mainId}"})
    public Result<?> d(@PathVariable("table") String paramString1, @PathVariable("mainId") String paramString2) {
        try {
            return Result.ok(this.onlCgformHeadService.queryManySubFormData(paramString1, paramString2));
        } catch (Exception exception) {
            a.error("Online表单查询异常：" + exception.getMessage(), exception);
            return Result.error("查询失败，" + exception.getMessage());
        }
    }

    @AutoLog(operateType = 1, value = "online根据表名查询表单数据", module = ModuleType.ONLINE)
    @GetMapping({"/form/table_name/{tableName}/{dataId}"})
    public Result<?> e(@PathVariable("tableName") String paramString1, @PathVariable("dataId") String paramString2) {
        try {
            LambdaQueryWrapper<OnlCgformHead> lambdaQueryWrapper = new LambdaQueryWrapper<>();
            lambdaQueryWrapper.eq(OnlCgformHead::getTableName, paramString1);
            OnlCgformHead onlCgformHead = this.onlCgformHeadService.getOne(lambdaQueryWrapper);
            if (onlCgformHead == null) {
                throw new Exception("OnlCgform tableName: " + paramString1 + " 不存在！");
            }
            Result<?> result = b(onlCgformHead.getId(), paramString2);
            result.setOnlTable(paramString1);
            return result;
        } catch (Exception exception) {
            a.error("Online表单查询异常，" + exception.getMessage(), exception);
            return Result.error("查询失败，" + exception.getMessage());
        }
    }

    @AutoLog(operateType = 2, value = "online新增数据", module = ModuleType.ONLINE)
    @OnlineAuth("form")
    @PostMapping({"/form/{code}"})
    public Result<String> a(@PathVariable("code") String paramString, @RequestBody JSONObject paramJSONObject, HttpServletRequest paramHttpServletRequest) {
        Result<String> result = new Result<>();
        try {
            String str1 = org.boyan.modules.cgform.util.b.a();
            paramJSONObject.put("id", str1);
            String str2 = TokenUtils.getTokenByRequest(paramHttpServletRequest);
            String str3 = this.onlCgformHeadService.saveManyFormData(paramString, paramJSONObject, str2);
            result.setSuccess(true);
            result.setResult(str1);
            result.setOnlTable(str3);
        } catch (Exception exception) {
            a.error("OnlCgformApiController.formAdd()发生异常：", exception);
            result.setSuccess(false);
            result.setMessage("保存失败，" + org.boyan.modules.cgform.util.b.a(exception));
        }
        return result;
    }

    @AutoLog(operateType = 3, value = "online修改数据", module = ModuleType.ONLINE)
    @OnlineAuth("form")
    @PutMapping({"/form/{code}"})
    public Result<?> a(@PathVariable("code") String paramString, @RequestBody JSONObject paramJSONObject) {
        try {
            String str = this.onlCgformHeadService.editManyFormData(paramString, paramJSONObject);
            Result<?> result = Result.ok("修改成功！");
            result.setOnlTable(str);
            return result;
        } catch (Exception exception) {
            a.error("OnlCgformApiController.formEdit()发生异常：" + exception.getMessage(), exception);
            return Result.error("修改失败，" + org.boyan.modules.cgform.util.b.a(exception));
        }
    }

    @AutoLog(operateType = 4, value = "online删除数据", module = ModuleType.ONLINE)
    @OnlineAuth("form")
    @DeleteMapping({"/form/{code}/{id}"})
    public Result<?> f(@PathVariable("code") String paramString1, @PathVariable("id") String paramString2) {
        OnlCgformHead onlCgformHead = this.onlCgformHeadService.getById(paramString1);
        if (onlCgformHead == null) {
            return Result.error("实体不存在");
        }
        try {
            String str = "";
            if ("Y".equals(onlCgformHead.getIsTree())) {
                paramString2 = this.onlCgformFieldService.queryTreeChildIds(onlCgformHead, paramString2);
                str = this.onlCgformFieldService.queryTreePids(onlCgformHead, paramString2);
            }
            if (paramString2.indexOf(",") > 0) {
                if (onlCgformHead.getTableType() == 2) {
                    this.onlCgformFieldService.deleteAutoListMainAndSub(onlCgformHead, paramString2);
                } else {
                    String str1 = onlCgformHead.getTableName();
                    this.onlCgformFieldService.deleteAutoListById(str1, paramString2);
                }
                if ("Y".equals(onlCgformHead.getIsTree())) {
                    String str1 = onlCgformHead.getTableName();
                    String str2 = onlCgformHead.getTreeIdField();
                    String[] arrayOfString = str.split(",");
                    for (String str3 : arrayOfString) {
                        this.onlCgformFieldService.updateTreeNodeNoChild(str1, str2, str3);
                    }
                }
            } else {
                this.onlCgformHeadService.deleteOneTableInfo(paramString1, paramString2);
            }
            if (oConvertUtils.isNotEmpty(onlCgformHead.getIsDesForm()) && "1".equals(onlCgformHead.getIsDesForm())) {
                this.onlCgformFieldService.deleteAutoList("design_form_data", "online_form_data_id", paramString2);
            }
        } catch (Exception exception) {
            a.error("OnlCgformApiController.formEdit()发生异常：" + exception.getMessage(), exception);
            return Result.error("删除失败," + exception.getMessage());
        }
        Result<?> result = Result.ok("删除成功!");
        result.setOnlTable(onlCgformHead.getTableName());
        return result;
    }

    @AutoLog(operateType = 4, value = "online删除数据", module = ModuleType.ONLINE)
    @DeleteMapping({"/formByCode/{code}/{id}"})
    public Result<?> g(@PathVariable("code") String paramString1, @PathVariable("id") String paramString2) {
        try {
            String str = this.onlCgformHeadService.deleteDataByCode(paramString1, paramString2);
            Result<?> result = Result.OK("删除成功!", str);
            result.setOnlTable(str);
            return result;
        } catch (JeecgBootException jeecgBootException) {
            return Result.error(jeecgBootException.getMessage());
        }
    }

    @OnlineAuth("getQueryInfo")
    @GetMapping({"/getQueryInfo/{code}"})
    public Result<?> b(@PathVariable("code") String paramString) {
        try {
            List<Map<String, String>> list = this.onlCgformFieldService.getAutoListQueryInfo(paramString);
            return Result.ok(list);
        } catch (Exception exception) {
            a.error("OnlCgformApiController.getQueryInfo()发生异常：" + exception.getMessage(), exception);
            return Result.error("查询失败");
        }
    }

    @PostMapping({"/doDbSynch/{code}/{synMethod}"})
    public Result<?> h(@PathVariable("code") String paramString1, @PathVariable("synMethod") String paramString2) {
        try {
            long l = System.currentTimeMillis();
            this.onlCgformHeadService.doDbSynch(paramString1, paramString2);
            a.info("==同步数据库消耗时间" + (System.currentTimeMillis() - l) + "毫秒");
        } catch (Exception exception) {
            a.error(exception.getMessage(), exception);
            return Result.error("同步数据库失败，" + org.boyan.modules.cgform.util.b.a(exception));
        }
        return Result.ok("同步数据库成功!");
    }

    @OnlineAuth("exportXls")
    @PermissionData
    @GetMapping({"/exportXls/{code}"})
    public void a(@PathVariable("code") String paramString, HttpServletRequest paramHttpServletRequest, HttpServletResponse paramHttpServletResponse) {
        OnlCgformHead onlCgformHead = this.onlCgformHeadService.getById(paramString);
        if (onlCgformHead == null) {
            return;
        }
        String str1 = onlCgformHead.getTableTxt();
        String str2 = paramHttpServletRequest.getParameter("paramsStr");
        Map<String, Object> map = new HashMap<>();
        Object object = null;
        if (oConvertUtils.isNotEmpty(str2)) {
            map = (Map)JSONObject.parseObject(str2, Map.class);
        }
        map.put("pageSize", -521);
        boolean bool = org.boyan.modules.cgform.util.b.a(onlCgformHead);
        Map map1 = null;
        if (bool) {
            map1 = this.onlineJoinQueryService.pageList(onlCgformHead, map, true);
        } else {
            map1 = this.onlCgformFieldService.queryAutolistPage(onlCgformHead.getTableName(), onlCgformHead.getId(), map, null);
        }
        List<OnlCgformField> list = (List)map1.get("fieldList");
        List list1 = (List)map1.get("records");
        List<Map<String, Object>> list2 = new ArrayList<>();
        String str3 = (map.get("selections") == null) ? null : map.get("selections").toString();
        if (oConvertUtils.isNotEmpty(str3)) {
            List<String> list4 = Arrays.asList(str3.split(","));
            list2 = (List)(list1).stream().filter((var1x) -> {
                return list4.contains(((Map)var1x).get("id"));
            }).collect(Collectors.toList());
        } else {
            if (list1 == null) {
                list1 = new ArrayList();
            }
            list2.addAll(list1);
        }
        b.a(1, list2, list);
        try {
            this.onlCgformHeadService.executeEnhanceExport(onlCgformHead, list2);
        } catch (BusinessException businessException) {
            a.error("导出java增强处理出错", businessException.getMessage());
        }
        List<ExcelExportEntity> list3 = a(list, "id");
        if (onlCgformHead.getTableType().intValue() == 2) {
            if (oConvertUtils.isEmpty(map.get("exportSingleOnly"))) {
                String str = onlCgformHead.getSubTableStr();
                if (oConvertUtils.isNotEmpty(str)) {
                    String[] arrayOfString = str.split(",");
                    for (String str4 : arrayOfString) {
                        a(str4, (Map)map, list2, list3);
                    }
                }
            }
        }
        Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(null, str1), list3, list2);
        ServletOutputStream servletOutputStream = null;
        try {
            paramHttpServletResponse.setContentType("application/x-msdownload;charset=utf-8");
            String str4 = BrowserUtils.checkBrowse(paramHttpServletRequest);
            String str5 = onlCgformHead.getTableTxt() + "-v" + onlCgformHead.getTableVersion();
            if ("MSIE".equalsIgnoreCase(str4.substring(0, 4))) {
                paramHttpServletResponse.setHeader("content-disposition", "attachment;filename=" + URLEncoder.encode(str5, "UTF-8") + ".xls");
            } else {
                String str = new String(str5.getBytes(StandardCharsets.UTF_8), "ISO8859-1");
                paramHttpServletResponse.setHeader("content-disposition", "attachment;filename=" + str + ".xls");
            }
            servletOutputStream = paramHttpServletResponse.getOutputStream();
            workbook.write((OutputStream)servletOutputStream);
            paramHttpServletResponse.flushBuffer();
        } catch (Exception exception) {
            a.error("--通过流的方式获取文件异常--" + exception.getMessage(), exception);
        } finally {
            if (servletOutputStream != null) {
                try {
                    servletOutputStream.close();
                } catch (IOException e) {
                    a.error(e.getMessage(), e);
                }
            }
        }
    }

    @OnlineAuth("importXls")
    @PostMapping({"/importXls/{code}"})
    public Result<?> b(@PathVariable("code") String paramString, HttpServletRequest paramHttpServletRequest, HttpServletResponse paramHttpServletResponse) {
        long l = System.currentTimeMillis();
        Result<Object> result = new Result<>();
        String str1 = "";
        String str2 = paramHttpServletRequest.getParameter("validateStatus");
        StringBuffer stringBuffer = new StringBuffer();
        try {
            OnlCgformHead onlCgformHead = (OnlCgformHead)this.onlCgformHeadService.getById(paramString);
            if (onlCgformHead == null) {
                return Result.error("数据库不存在该表记录");
            }
            LambdaQueryWrapper<OnlCgformField> lambdaQueryWrapper = new LambdaQueryWrapper<>();
            lambdaQueryWrapper.eq(OnlCgformField::getCgformHeadId, paramString);
            List<OnlCgformField> list1 = this.onlCgformFieldService.list(lambdaQueryWrapper);
            String str3 = paramHttpServletRequest.getParameter("isSingleTableImport");
            List<String> list2 = org.boyan.modules.cgform.util.b.e(list1);
            if (oConvertUtils.isEmpty(str3) && onlCgformHead.getTableType() == 2 && oConvertUtils.isNotEmpty(onlCgformHead.getSubTableStr())) {
                for (String str : onlCgformHead.getSubTableStr().split(",")) {
                    OnlCgformHead onlCgformHead1 = this.onlCgformHeadService.getOne(new LambdaQueryWrapper<OnlCgformHead>()
                            .eq(OnlCgformHead::getTableName, str));
                    if (onlCgformHead1 != null) {
                        List<OnlCgformField> list3 = this.onlCgformFieldService.list(new LambdaQueryWrapper<OnlCgformField>()
                                .eq(OnlCgformField::getCgformHeadId, onlCgformHead1.getId()));
                        List<String> list4 = org.boyan.modules.cgform.util.b.b(list3, onlCgformHead1.getTableTxt());
                        if (list4.size() > 0) {
                            list2.addAll(list4);
                        }
                    }
                }
            }
            JSONObject jSONObject = null;
            String str4 = paramHttpServletRequest.getParameter("foreignKeys");
            if (oConvertUtils.isNotEmpty(str4)) {
                jSONObject = JSONObject.parseObject(str4);
            }
            MultipartHttpServletRequest multipartHttpServletRequest = (MultipartHttpServletRequest)paramHttpServletRequest;
            Map<String, MultipartFile> map = multipartHttpServletRequest.getFileMap();
            DataSource dataSource = SpringContextUtils.getApplicationContext().getBean(DataSource.class);
            String str5 = org.boyan.modules.config.b.d.a(dataSource);
            for (Map.Entry entry : map.entrySet()) {
                MultipartFile multipartFile = (MultipartFile)entry.getValue();
                ImportParams importParams = new ImportParams();
                importParams.setImageList(list2);
                importParams.setDataHanlder(new org.boyan.modules.cgform.util.a(list1, this.upLoadPath, this.uploadType));
                List list = ExcelImportUtil.importExcel(multipartFile.getInputStream(), Map.class, importParams);
                if (list == null) {
                    str1 = "识别模版数据错误";
                    a.error(str1);
                    continue;
                }
                String str = "";
                ArrayList<Map<String, Object>> arrayList = new ArrayList<>();
                for (Map<String, Object> map1 : (Iterable<Map<String, Object>>)list) {
                    Object object = null;
                    boolean bool = false;
                    Set<String> set = map1.keySet();
                    HashMap<String, Object> hashMap = new HashMap<>();
                    for (String str6 : set) {
                        if (!str6.contains("$subTable$")) {
                            if (str6.contains("$mainTable$") && oConvertUtils.isNotEmpty(map1.get(str6).toString())) {
                                bool = true;
                                object = a(onlCgformHead, dataSource, str5);
                            }
                            hashMap.put(str6.replace("$mainTable$", ""), map1.get(str6));
                        }
                    }
                    if (bool) {
                        hashMap.put("id", object);
                        arrayList.add(hashMap);
                        object = hashMap.get("id");
                    }
                    if (jSONObject != null) {
                        for (String str6 : jSONObject.keySet()) {
                            System.out.println(str6 + "=" + jSONObject.getString(str6));
                            hashMap.put(str6, jSONObject.getString(str6));
                        }
                    }
                    map1.put("$mainTable$id", object);
                }
                if (arrayList.size() == 0) {
                    result.setSuccess(false);
                    result.setMessage("导入失败，匹配的数据条数为零!");
                    return result;
                }
                if ("1".equals(str2)) {
                    Map<String, String> map1 = this.onlCgformSqlService.saveOnlineImportDataWithValidate(onlCgformHead, list1, arrayList);
                    String str6 = map1.get("error");
                    str1 = map1.get("tip");
                    if (str6 != null && str6.length() > 0) {
                        stringBuffer.append(onlCgformHead.getTableTxt()).append("导入校验,").append(str1).append(",详情如下:\r\n").append(str6);
                    }
                } else {
                    this.onlCgformSqlService.saveBatchOnlineTable(onlCgformHead, list1, arrayList);
                }
                if (oConvertUtils.isEmpty(str3) && onlCgformHead.getTableType() == 2 && oConvertUtils.isNotEmpty(onlCgformHead.getSubTableStr())) {
                    for (String str6 : onlCgformHead.getSubTableStr().split(",")) {
                        OnlCgformHead onlCgformHead1 = this.onlCgformHeadService.getOne(new LambdaQueryWrapper<OnlCgformHead>()
                                .eq(OnlCgformHead::getTableName, str6));
                        if (onlCgformHead1 != null) {
                            LambdaQueryWrapper<OnlCgformField> lambdaQueryWrapper1 = new LambdaQueryWrapper<>();
                            lambdaQueryWrapper1.eq(OnlCgformField::getCgformHeadId, onlCgformHead1.getId());
                            List<OnlCgformField> list3 = this.onlCgformFieldService.list(lambdaQueryWrapper1);
                            ArrayList<Map<String, Object>> arrayList1 = new ArrayList<>();
                            String str7 = onlCgformHead1.getTableTxt();
                            for (Object map2 : list) {
                                Map map1 = (Map) map2;
                                boolean bool = false;
                                HashMap<String, Object> hashMap = new HashMap<>();
                                for (OnlCgformField onlCgformField : list3) {
                                    String str8 = onlCgformField.getMainTable();
                                    String str9 = onlCgformField.getMainField();
                                    boolean bool1 = onlCgformHead.getTableName().equals(str8) && oConvertUtils.isNotEmpty(str9);
                                    String str10 = str7 + "_" + onlCgformField.getDbFieldTxt();
                                    if (bool1) {
                                        hashMap.put(onlCgformField.getDbFieldName(), map1.get("$mainTable$" + str9));
                                    }
                                    Object object = map1.get("$subTable$" + str10);
                                    if (null != object && oConvertUtils.isNotEmpty(object.toString())) {
                                        bool = true;
                                        hashMap.put(onlCgformField.getDbFieldName(), object);
                                    }
                                }
                                if (bool) {
                                    hashMap.put("id", a(onlCgformHead1, dataSource, str5));
                                    arrayList1.add(hashMap);
                                }
                            }
                            if (arrayList1.size() > 0) {
                                if ("1".equals(str2)) {
                                    Map<String, String> map1 = this.onlCgformSqlService.saveOnlineImportDataWithValidate(onlCgformHead1, list3, arrayList1);
                                    String str8 = (String)map1.get("error");
                                    String str9 = (String)map1.get("tip");
                                    if (str8 != null && str8.length() > 0) {
                                        stringBuffer.append(onlCgformHead1.getTableTxt()).append("导入校验,").append(str9).append(",详情如下:\r\n").append(str8);
                                    }
                                } else {
                                    this.onlCgformSqlService.saveBatchOnlineTable(onlCgformHead1, list3, arrayList1);
                                }
                            }
                        }
                    }
                }
            }
            result.setSuccess(true);
            if ("1".equals(str2) && stringBuffer.length() > 0) {
                String str = org.boyan.modules.cgform.util.b.a(this.upLoadPath, onlCgformHead.getTableTxt(), stringBuffer);
                result.setResult(str);
                result.setMessage(str1);
                result.setCode(201);
            } else {
                result.setMessage("导入成功!");
            }
        } catch (Exception exception) {
            result.setSuccess(false);
            result.setMessage(exception.getMessage());
            a.error(exception.getMessage(), exception);
        }
        a.info("=====online导入数据完成,耗时:" + (System.currentTimeMillis() - l) + "毫秒=====");
        return result;
    }

    @PostMapping({"/doButton"})
    public Result<?> a(@RequestBody JSONObject paramJSONObject) {
        String str1 = paramJSONObject.getString("formId");
        String str2 = paramJSONObject.getString("dataId");
        String str3 = paramJSONObject.getString("buttonCode");
        JSONObject jSONObject = paramJSONObject.getJSONObject("uiFormData");
        try {
            this.onlCgformHeadService.executeCustomerButton(str3, str1, str2);
        } catch (Exception exception) {
            a.error(exception.getMessage(), exception);
            return Result.error("执行失败," + exception.getMessage());
        }
        return Result.ok("执行成功!");
    }

    public Object a(OnlCgformHead paramOnlCgformHead, DataSource paramDataSource, String paramString) throws SQLException, DBException {
        String str1 = null;
        String str2 = paramOnlCgformHead.getIdType();
        String str3 = paramOnlCgformHead.getIdSequence();
        if (oConvertUtils.isNotEmpty(str2) && "UUID".equalsIgnoreCase(str2)) {
            str1 = org.boyan.modules.cgform.util.b.a();
        } else if (oConvertUtils.isNotEmpty(str2) && "NATIVE".equalsIgnoreCase(str2)) {
            if (oConvertUtils.isNotEmpty(paramString) && "oracle".equalsIgnoreCase(paramString)) {
                OracleSequenceMaxValueIncrementer oracleSequenceMaxValueIncrementer = new OracleSequenceMaxValueIncrementer(paramDataSource, "HIBERNATE_SEQUENCE");
                try {
                    Long long_ = oracleSequenceMaxValueIncrementer.nextLongValue();
                } catch (Exception exception) {
                    a.error(exception.getMessage(), exception);
                }
            } else if (oConvertUtils.isNotEmpty(paramString) && "postgres".equalsIgnoreCase(paramString)) {
                PostgreSQLSequenceMaxValueIncrementer postgreSQLSequenceMaxValueIncrementer = new PostgreSQLSequenceMaxValueIncrementer(paramDataSource, "HIBERNATE_SEQUENCE");
                try {
                    Long long_ = postgreSQLSequenceMaxValueIncrementer.nextLongValue();
                } catch (Exception exception) {
                    a.error(exception.getMessage(), exception);
                }
            } else {
                str1 = null;
            }
        } else if (oConvertUtils.isNotEmpty(str2) && "SEQUENCE".equalsIgnoreCase(str2)) {
            if (oConvertUtils.isNotEmpty(paramString) && "oracle".equalsIgnoreCase(paramString)) {
                OracleSequenceMaxValueIncrementer oracleSequenceMaxValueIncrementer = new OracleSequenceMaxValueIncrementer(paramDataSource, str3);
                try {
                    Long long_ = Long.valueOf(oracleSequenceMaxValueIncrementer.nextLongValue());
                } catch (Exception exception) {
                    a.error(exception.getMessage(), exception);
                }
            } else if (oConvertUtils.isNotEmpty(paramString) && "postgres".equalsIgnoreCase(paramString)) {
                PostgreSQLSequenceMaxValueIncrementer postgreSQLSequenceMaxValueIncrementer = new PostgreSQLSequenceMaxValueIncrementer(paramDataSource, str3);
                try {
                    Long long_ = Long.valueOf(postgreSQLSequenceMaxValueIncrementer.nextLongValue());
                } catch (Exception exception) {
                    a.error(exception.getMessage(), exception);
                }
            } else {
                str1 = null;
            }
        } else {
            str1 = org.boyan.modules.cgform.util.b.a();
        }
        return str1;
    }

    private void a(Map<String, String> paramMap, List<OnlCgformField> paramList) {
        for (OnlCgformField onlCgformField : paramList) {
            String str1 = onlCgformField.getDictTable();
            String str2 = onlCgformField.getDictField();
            String str3 = onlCgformField.getDictText();
            if (oConvertUtils.isEmpty(str1) && oConvertUtils.isEmpty(str2)) {
                continue;
            }
            if (!"popup".equals(onlCgformField.getFieldShowType())) {
                List<DictModel> list;
                String str = String.valueOf(paramMap.get(onlCgformField.getDbFieldName()));
                if (oConvertUtils.isEmpty(str1)) {
                    list = this.sysBaseAPI.queryDictItemsByCode(str2);
                } else {
                    list = this.sysBaseAPI.queryTableDictItemsByCode(str1, str3, str2);
                }
                for (DictModel dictModel : list) {
                    if (str.equals(dictModel.getText())) {
                        paramMap.put(onlCgformField.getDbFieldName(), dictModel.getValue());
                    }
                }
            }
        }
    }

    private List<ExcelExportEntity> a(List<OnlCgformField> paramList, String paramString) {
        ArrayList<ExcelExportEntity> arrayList = new ArrayList<>();
        for (OnlCgformField onlCgformField : paramList) {
            if (null == paramString || !paramString.equals(onlCgformField.getDbFieldName())) {
                if (onlCgformField.getIsShowList() == 1) {
                    String str = onlCgformField.getDbFieldName();
                    ExcelExportEntity excelExportEntity = new ExcelExportEntity(onlCgformField.getDbFieldTxt(), str);
                    if ("image".equals(onlCgformField.getFieldShowType())) {
                        excelExportEntity.setType(2);
                        excelExportEntity.setExportImageType(3);
                        excelExportEntity.setImageBasePath(this.upLoadPath);
                        excelExportEntity.setHeight(50.0D);
                        excelExportEntity.setWidth(60.0D);
                    } else {
                        int b1 = (onlCgformField.getDbLength() == 0) ? 12 : ((onlCgformField.getDbLength() > 30) ? 30 : onlCgformField.getDbLength());
                        if ("date".equals(onlCgformField.getFieldShowType())) {
                            excelExportEntity.setFormat("yyyy-MM-dd");
                        } else if ("datetime".equals(onlCgformField.getFieldShowType())) {
                            excelExportEntity.setFormat("yyyy-MM-dd HH:mm:ss");
                        }
                        if (b1 < 10) {
                            b1 = 10;
                        }
                        excelExportEntity.setWidth(b1);
                    }
                    arrayList.add(excelExportEntity);
                }
            }
        }
        return arrayList;
    }

    private void a(String paramString, Map<String, Object> paramMap, List<Map<String, Object>> paramList, List<ExcelExportEntity> paramList1) {
        OnlCgformHead onlCgformHead = this.onlCgformHeadService.getOne(new LambdaQueryWrapper<OnlCgformHead>()
                .eq(OnlCgformHead::getTableName, paramString));
        LambdaQueryWrapper<OnlCgformField> lambdaQueryWrapper = new LambdaQueryWrapper();
        lambdaQueryWrapper.eq(OnlCgformField::getCgformHeadId, onlCgformHead.getId());
        lambdaQueryWrapper.orderByAsc(OnlCgformField::getOrderNum);
        List<OnlCgformField> list = this.onlCgformFieldService.list(lambdaQueryWrapper);
        String str1 = "", str2 = "";
        for (OnlCgformField onlCgformField : list) {
            if (oConvertUtils.isNotEmpty(onlCgformField.getMainField())) {
                str1 = onlCgformField.getMainField();
                str2 = onlCgformField.getDbFieldName();
                break;
            }
        }
        ExcelExportEntity excelExportEntity = new ExcelExportEntity(onlCgformHead.getTableTxt(), paramString);
        excelExportEntity.setList(a(list, "id"));
        paramList1.add(excelExportEntity);
        for (Map<String, Object> stringObjectMap : paramList) {
            paramMap.put(str2, stringObjectMap.get(str1));
            String str = org.boyan.modules.cgform.util.b.a(onlCgformHead.getTableName(), list, paramMap);
            a.info("-----------动态列表查询子表sql》》" + str);
            List<Map<String, Object>> list1 = this.onlCgformHeadService.queryListData(str);
            b.a(1, list1, list);
            stringObjectMap.put(paramString, org.boyan.modules.cgform.util.b.d(list1));
        }
    }

    @GetMapping({"/checkOnlyTable"})
    public Result<?> i(@RequestParam("tbname") String paramString1, @RequestParam("id") String paramString2) {
        if (oConvertUtils.isEmpty(paramString2)) {
            if (org.boyan.modules.config.b.d.a(paramString1)) {
                return Result.ok(-1);
            }
            OnlCgformHead onlCgformHead = this.onlCgformHeadService.getOne(
                    new LambdaQueryWrapper<OnlCgformHead>()
                            .eq(OnlCgformHead::getTableName, paramString1));
            if (oConvertUtils.isNotEmpty(onlCgformHead)) {
                return Result.ok(-1);
            }
        } else {
            OnlCgformHead onlCgformHead = this.onlCgformHeadService.getById(paramString2);
            if (!paramString1.equals(onlCgformHead.getTableName()) &&
                    org.boyan.modules.config.b.d.a(paramString1)) {
                return Result.ok(-1);
            }
        }
        return Result.ok(1);
    }

    @PostMapping({"/codeGenerate"})
    public Result<?> b(@RequestBody JSONObject paramJSONObject) {
        OnlGenerateModel onlGenerateModel = JSONObject.parseObject(paramJSONObject.toJSONString(), OnlGenerateModel.class);
        List<String> list = null;
        try {
            if ("1".equals(onlGenerateModel.getJformType())) {
                list = this.onlCgformHeadService.generateCode(onlGenerateModel);
            } else {
                list = this.onlCgformHeadService.generateOneToMany(onlGenerateModel);
            }
            return Result.ok(list);
        } catch (Exception exception) {
            exception.printStackTrace();
            return Result.error(exception.getMessage());
        }
    }

    @GetMapping({"/downGenerateCode"})
    public void a(@RequestParam("fileList") List<String> paramList, HttpServletRequest paramHttpServletRequest, HttpServletResponse paramHttpServletResponse) {
        List<String> list = paramList.stream().filter(paramString -> (!paramString.contains("src/main/java") && !paramString.contains("src%5Cmain%5Cjava"))).collect(Collectors.toList());
        if (list.size() > 0) {
            a.error(" fileList 不合法！！！", paramList);
            return;
        }
        String str1 = "生成代码_" + System.currentTimeMillis() + ".zip";
        String str2 = "/opt/temp/codegenerate/" + str1;
        File file = d.a(paramList, str2);
        assert file != null;
        if (file.exists()) {
            paramHttpServletResponse.setContentType("application/force-download");
            paramHttpServletResponse.addHeader("Content-Disposition", "attachment;fileName=" + str1);
            byte[] arrayOfByte = new byte[1024];
            FileInputStream fileInputStream = null;
            BufferedInputStream bufferedInputStream = null;
            try {
                fileInputStream = new FileInputStream(file);
                bufferedInputStream = new BufferedInputStream(fileInputStream);
                ServletOutputStream servletOutputStream = paramHttpServletResponse.getOutputStream();
                int i = bufferedInputStream.read(arrayOfByte);
                while (i != -1) {
                    servletOutputStream.write(arrayOfByte, 0, i);
                    i = bufferedInputStream.read(arrayOfByte);
                }
            } catch (Exception exception) {
                exception.printStackTrace();
            } finally {
                if (bufferedInputStream != null) {
                    try {
                        bufferedInputStream.close();
                    } catch (IOException iOException) {
                        iOException.printStackTrace();
                    }
                }
                if (fileInputStream != null) {
                    try {
                        fileInputStream.close();
                    } catch (IOException iOException) {
                        iOException.printStackTrace();
                    }
                }
                (new Thread((Runnable) this, str2) {
                    @Override
                    public void run() {
                        try {
                            Thread.sleep(10000L);
                            FileUtil.del(str2);
                        } catch (InterruptedException interruptedException) {
                            interruptedException.printStackTrace();
                        }
                    }
                }).start();
            }
        }
    }

    @AutoLog(operateType = 1, value = "online列表数据查询", module = ModuleType.ONLINE)
    @GetMapping({"/getTreeData/{code}"})
    @PermissionData
    public Result<Map<String, Object>> d(@PathVariable("code") String paramString, HttpServletRequest paramHttpServletRequest) {
        Result<Map<String, Object>> result = new Result<>();
        OnlCgformHead onlCgformHead = (OnlCgformHead)this.onlCgformHeadService.getById(paramString);
        if (onlCgformHead == null) {
            result.error500("实体不存在");
            return result;
        }
        try {
            String str1 = onlCgformHead.getTableName();
            String str2 = onlCgformHead.getTreeIdField();
            String str3 = onlCgformHead.getTreeParentIdField();
            ArrayList arrayList = Lists.newArrayList((Object[])new String[] { str2, str3 });
            Map<String, Object> map = org.boyan.modules.cgform.util.b.a(paramHttpServletRequest);
            String str4 = null;
            if (map.get(str2) != null) {
                str4 = map.get(str2).toString();
            }
            if (map.get("hasQuery") != null && "false".equals(map.get("hasQuery")) && map.get(str3) == null) {
                map.put(str3, "0");
            } else {
                map.put("pageSize", -521);
                map.put(str3, map.get(str3));
            }
            map.put(str2, null);
            Map<String, Object> map1 = this.onlCgformFieldService.queryAutoTreeNoPage(str1, paramString, map, arrayList, str3);
            a(onlCgformHead, map1);
            result.setResult(map1);
        } catch (Exception exception) {
            a.error(exception.getMessage(), exception);
            result.error500("数据库查询失败" + exception.getMessage());
        }
        result.setOnlTable(onlCgformHead.getTableName());
        return result;
    }

    private void a(OnlCgformHead paramOnlCgformHead, Map<String, Object> paramMap) throws BusinessException {
        List list = (List)paramMap.get("records");
        this.onlCgformHeadService.executeEnhanceList(paramOnlCgformHead, "query", list);
    }

    @PostMapping({"/crazyForm/{name}"})
    public Result<?> b(@PathVariable("name") String paramString, @RequestBody JSONObject paramJSONObject) {
        Result<String> result = new Result<>();
        try {
            String str = org.boyan.modules.cgform.util.b.a();
            paramJSONObject.put("id", str);
            this.onlCgformHeadService.addCrazyFormData(paramString, paramJSONObject);
            result.setResult(str);
            result.setMessage("保存成功");
        } catch (Exception exception) {
            a.error("OnlCgformApiController.formAddForDesigner()发生异常：" + exception.getMessage(), exception);
            return Result.error("保存失败");
        }
        return result;
    }

    @PutMapping({"/crazyForm/{name}"})
    public Result<?> c(@PathVariable("name") String paramString, @RequestBody JSONObject paramJSONObject) {
        try {
            paramJSONObject.remove("create_by");
            paramJSONObject.remove("create_time");
            paramJSONObject.remove("update_by");
            paramJSONObject.remove("update_time");
            this.onlCgformHeadService.editCrazyFormData(paramString, paramJSONObject);
        } catch (Exception exception) {
            a.error("OnlCgformApiController.formEditForDesigner()发生异常：" + exception.getMessage(), exception);
            return Result.error("保存失败");
        }
        return Result.ok("保存成功!");
    }

    @AutoLog(operateType = 1, value = "online列表加载", module = ModuleType.ONLINE)
    @GetMapping({"/getErpColumns/{code}"})
    public Result<Map<String, Object>> c(@PathVariable("code") String paramString) {
        Result<Map<String, Object>> result = new Result<>();
        OnlCgformHead onlCgformHead = (OnlCgformHead)this.onlCgformHeadService.getById(paramString);
        if (onlCgformHead == null) {
            result.error500("实体不存在");
            return result;
        }
        HashMap<String, Object> hashMap = new HashMap<>();
        LoginUser loginUser = (LoginUser)SecurityUtils.getSubject().getPrincipal();
        OnlComplexModel onlComplexModel = this.onlineService.queryOnlineConfig(onlCgformHead, loginUser.getUsername());
        hashMap.put("main", onlComplexModel);
        if ("erp".equals(onlCgformHead.getThemeTemplate()) && onlCgformHead.getTableType() == 2) {
            String str = onlCgformHead.getSubTableStr();
            if (oConvertUtils.isNotEmpty(str)) {
                ArrayList<OnlComplexModel> arrayList = new ArrayList<>();
                for (String str1 : str.split(",")) {
                    OnlCgformHead onlCgformHead1 = this.onlCgformHeadService.getOne(new LambdaQueryWrapper<OnlCgformHead>()
                            .eq(OnlCgformHead::getTableName, str1));
                    if (onlCgformHead1 != null) {
                        arrayList.add(this.onlineService.queryOnlineConfig(onlCgformHead1, loginUser.getUsername()));
                    }
                }
                if (arrayList.size() > 0) {
                    hashMap.put("subList", arrayList);
                }
            }
        }
        result.setOnlTable(onlCgformHead.getTableName());
        result.setResult(hashMap);
        result.setSuccess(true);
        return result;
    }

    @AutoLog(operateType = 1, value = "online表单加载", module = ModuleType.ONLINE)
    @GetMapping({"/getErpFormItem/{code}"})
    public Result<?> e(@PathVariable("code") String paramString, HttpServletRequest paramHttpServletRequest) {
        OnlCgformHead onlCgformHead = (OnlCgformHead)this.onlCgformHeadService.getById(paramString);
        if (onlCgformHead == null) {
            Result.error("表不存在");
        }
        Result<JSONObject> result = new Result<>();
        LoginUser loginUser = (LoginUser)SecurityUtils.getSubject().getPrincipal();
        JSONObject jSONObject = this.onlineService.queryOnlineFormObj(onlCgformHead, loginUser.getUsername());
        result.setResult(org.boyan.modules.cgform.util.b.b(jSONObject));
        assert onlCgformHead != null;
        result.setOnlTable(onlCgformHead.getTableName());
        return result;
    }

    @GetMapping({"/querySelectOptions"})
    public Result<List<TreeModel>> a(@ModelAttribute org.boyan.modules.cgform.a.a parama) {
        Result<List<TreeModel>> result = new Result<>();
        List<TreeModel> list = this.onlCgformFieldService.queryDataListByLinkDown(parama);
        result.setResult(list);
        result.setSuccess(true);
        return result;
    }

    @GetMapping({"/data/{tableName}/queryById"})
    public JSONObject a(@PathVariable String paramString1, @RequestParam(name = "id") String paramString2, HttpServletRequest paramHttpServletRequest) {
        LambdaQueryWrapper<OnlCgformHead> lambdaQueryWrapper = new LambdaQueryWrapper<>();
        lambdaQueryWrapper.eq(OnlCgformHead::getTableName, paramString1);
        OnlCgformHead onlCgformHead = this.onlCgformHeadService.getOne(lambdaQueryWrapper);
        if (onlCgformHead == null) {
            throw new JeecgBootException("Online表单 " + paramString1 + " 不存在");
        }
        try {
            Map map = org.boyan.modules.cgform.util.b.a(paramHttpServletRequest);
            ArrayList<String> arrayList = new ArrayList<>();
            arrayList.add("id");
            Map<String, Object> map1 = this.onlCgformFieldService.queryAutolistPage(paramString1, onlCgformHead.getId(), map, arrayList);
            a(onlCgformHead, map1);
            JSONObject jSONObject = new JSONObject();
            jSONObject.put("data", map1.get("records"));
            return jSONObject;
        } catch (Exception exception) {
            a.error(exception.getMessage(), exception);
            throw new JeecgBootException("数据库查询失败，" + exception.getMessage());
        }
    }
}